﻿using Volo.Abp.Autofac;
using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Modularity;
using Volo.Abp.RabbitMQ;

namespace 发布日志
{
    [DependsOn(
       typeof(AbpEventBusRabbitMqModule),
       typeof(AbpAutofacModule)
       )]
    public class PublicModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            // 配置RabbitMQ客户端的连接字符串
            Configure<AbpRabbitMqOptions>(options =>
            {
                options.Connections.Default.UserName = "root";
                options.Connections.Default.Password = "123456";
                options.Connections.Default.HostName = "172.30.14.227";
                options.Connections.Default.Port = 5672;
            });

            // 配置客户端,交换机名称和预取数量
            Configure<AbpRabbitMqEventBusOptions>(options =>
            {
                //options.ClientName = "PublicReceiveEventLogs";    // 交换机 绑定队列名称(这里并不是当前交换机发布信息的队列)
                options.ExchangeName = "NuctechEventLogs"; // 交换机名称
                //options.PrefetchCount = 1;
            });
        }
    }
}